import { INestApplication } from '@nestjs/common';

export const useCors = (app: INestApplication) => {
  const corsOptions = {
    origin: '*',
    credentials: true,
    methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS', // 允许的 HTTP 方法
    allowedHeaders: 'Content-Type,Authorization', // 允许的请求头
  };
  app.enableCors(corsOptions);
};
